package cn.itsource.campus.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletResponse;

@Controller
@RequestMapping("/cookie")
public class CookieController {

    /**
     * 创建Cookie
     * @param response
     */
    @GetMapping("/addCookie")
    public void addCookie(HttpServletResponse response){
        //创建Cookie
        Cookie cookie = new Cookie("name", "zs");
        //把cookie响应给浏览器
        response.addCookie(cookie);

    }
}
